#include"sharedmem.hpp"
extern Log log;

int main()
{
    int shmid = getSharedMem();
    if(shmid < 0)
    {
        log(Fatal,"process b get fail!");
        exit(1);
    }
    log(Info,"process b get sucess !");
    char* address = (char*)shmat(shmid,nullptr,0);
    
    //通讯内容
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd < 0)
    {
        log(Fatal,"error string: error code:",strerror(errno),errno);
        exit(FILE_OPEN_ERR);
    }
    while(true)
    {
        char c = '1';
        std::cout << "Please Enter@ ";
        //std::cin >> address;
        fgets(address, 4096, stdin);
        write(fd,&c,1);
    }
    shmdt(address);
    close(fd);
    return 0;
}